// 题型

const {STRING,DATE,INTEGER} = require("sequelize")

const sequelize = require("../sequelize")

const Questiontype = sequelize.define("Questiontype",{
    title:{
        type:STRING,
        allowNull:false,
        unique:true,
        Comment:"题型"
    },
    
})

Questiontype.associate = function(){
    Questiontype.hasMany(sequelize.Choice,{
        foreignKey:"typeid",
        target:"id"
    })
    Questiontype.hasMany(sequelize.Judge,{
        foreignKey:"typeid",
        target:"id"
    })
    Questiontype.hasMany(sequelize.Answer,{
        foreignKey:"typeid",
        target:"id"
    })
    Questiontype.hasMany(sequelize.Conpletion,{
        foreignKey:"typeid",
        target:"id"
    })
}

module.exports = Questiontype